//
//  EXT-UIImageView.swift
//  SSSina
//
//  Created by ss on 2017/6/29.
//  Copyright © 2017年 ss. All rights reserved.
//

import UIKit
import SDWebImage
extension UIImageView {
    
    //快速实例化一个imageView
    convenience init(named:String){
        self.init(image: UIImage(named: named))
    }
    
    //对sdWebImage 封装
    func ss_setImage(withUrlSting:String?,placeholderImgName:String? = nil){
       
        if placeholderImgName == nil {
            self.sd_setImage(with: URL(string:withUrlSting ?? ""), placeholderImage: self.image)
        }else{
        self.sd_setImage(with: URL(string:withUrlSting ?? ""), placeholderImage: UIImage(named: placeholderImgName ?? ""))
        }
    }
}
